define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'groupcontent/index' + location.search,
                    // add_url: 'groupcontent/add',
                    edit_url: 'groupcontent/edit',
                    // del_url: 'groupcontent/del',
                    // multi_url: 'groupcontent/multi',
                    // import_url: 'groupcontent/import',
                    table: 'group_content',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                fixedColumns: true,
                fixedRightNumber: 1,
                columns: [
                    [
                        {checkbox: true},
                        {field: 'dream_id', title: __('dream号')},
                        {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        {field: 'tag_str', title: __('Tag_str'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                      
                         
                         {field: 'create_time', title: __('发布时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        //  {field: 'reason_msg', title: __('下架原因'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},

                         {field: 's_jb', title: __('冻结状态'), searchList: {"0":__('正常'),"1":__('违规下架')}, formatter: Table.api.formatter.status},
                       
                        
                         {field: 'row', title: __('内容'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        
                         {field: 'img', title: __('图片'), operate: false, events: Table.api.events.images, formatter: Table.api.formatter.images},
                         
                           
                        
                       
                                  
                         {field: 'up_time', title: __('最后更新时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        //  {field: 'sh_time', title: __('操作下架时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        
                        {field: 'operate', title: __('修改'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});
